<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>合伙人设置</title>
    <script src="__INDEX__/js/mui.min.js"></script>
	<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
	<link rel="stylesheet" href="__INDEX__/css/style.css" />
	<link rel="stylesheet" href="__INDEX__/css/mall.css" />	
	<script type="text/javascript" src="__INDEX__/dist/jquery.min.js" ></script>
	<script type="text/javascript" src="__INDEX__/js/menudown.js" ></script>
	<style>
		.liactive{
			background-color: #e5c890;
		}
	</style>
</head>
<body>
	<div class="mui-content">
	    {include file="public/member" /}
	    <div class="glj_bt"><span class="mui-icon iconfont icon-dingdan4"></span><em style="padding-left: 20px;">合伙人管理/合伙人设置</em></div>
	   <div class="my_orders"></div>
	   <div class="glj_bt" style="text-align: left;">合伙人搜索</div>
	   <div class="glj_bt1"><input style="font-size:12px;width:200px;height: 30px;line-height: 30px;border-radius: 15px;" id="name" type="text" placeholder="搜索姓名、手机号、会员编号"/>
	    <em style="padding-left: 20px;"></em><a href="#" onclick="find()">搜索</a></div>
	   <ul class="record_list2">
	    	<li class="clearfix">
	    		<div class="pj" style="width: 23%;">姓名/编号</div>
	    		<div class="pj" style="width: 17%;">手机号码</div>
	    		<div class="pj" style="width: 18%;">推荐人</div>
	    		<div class="pj1" style="width:25%;">加入时间</div>
	    		<div class="pj" style="width: 17%;">会员级别</div>
    		</li>
	    </ul>
	    <ul class="record_list2 list">
			
	    </ul>
		<p id="no_record" style="color:#D6AA50;text-align: center;display: none;">数据已加载完毕</p>
		<div class="my_orders"></div>
		<form id='my_form'>
		<div style="background-color: #fff;">
		<div class="glj_bt" style="text-align: center;">合伙人设置</div>
		<p style="margin-top:10px"><em style="padding: 5px 25px;">会员编号</em><input name="id" readonly="readonly" value=""  style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top:10px"><em style="padding: 5px 25px;">会员姓名</em><input name="real_name" value=""  style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top: 10px;"><em style="padding: 5px 25px;">会员手机</em><input name="mobile" value="" style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top: 10px;"><em style="padding: 5px 25px;">密码重置</em><input name="password" value="" style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top:10px"><em style="padding: 5px 25px;">会员微信</em><input name="wx_account" value=""  style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top:10px"><em style="padding: 5px 25px;">出生日期</em><input name="birthday" readonly="readonly" value=""  style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top: 10px;"><em style="padding: 5px 25px;">推&nbsp;荐&nbsp;人</em><input name="pid1" readonly="readonly"  value="" style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top: 10px;"><em style="padding: 5px 25px;">会员级别</em><input readonly="readonly" id="type" value="" style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<p style="margin-top: 10px;"><em style="padding: 5px 25px;">所在城市</em><input id="city" readonly="readonly" value="" style="font-size:12px;width:200px;height: 25px;line-height: 25px;border-radius: 15px;"  type="text" /></p>
	  	<div class="gerzl_btn" style="position: relative; text-align: center; line-height: 45px; height: 50px;">
		<button type="button" onclick="set_content()" class="layui-btn" style="background: #1ed925;width: 100%;">提交设置</button>
		</div>
	  </form>
	</div>
	<input type="hidden" id="page" value="1" />
			{include file="public/bottom" /}
</body>
</html>
	{include file="public/footer" /}
<script src="__PUBLIC__/static/js/mui.min.js"></script>
<script>
	var arr={};
	//提交表单
	function set_content() {
		var act=$(".liactive");
		if(act.length==0){
			layer.msg("您未选中任何合伙人!");
			return;
		}
		var nickname=$("#real_name").val();
		var phone = $("#mobile").val();
		if(nickname == '') {
			layer.msg('姓名不能为空');
			onoff = true;
			return;
		}
		/*if(phone == '') {
			layer.msg('手机号码不能为空');
			onoff = true;
			return;
		}*/
		/*var reg = /^1[3|4|5|6|7|8][0-9]{9}$/; //验证规则
		if(!reg.test(phone)) {
			layer.msg('手机号码格式不正确');
			onoff = true;
			return;
		}*/
		
		var province_tilte = $("#proS").find("option:selected").text(); 
		$('#province').val(province_tilte);
		
		var city_tilte = $("#cityS").find("option:selected").text(); 
		$('#city').val(city_tilte);
		
		$.ajax({
			type: "post",
			url: "{:url('city/update_mem')}",
			data: $('#my_form').serialize(), //表单数据
			success: function(data) {
				layer.msg(data.msg, {
					icon: 1,
					time: 1500 //2秒关闭（如果不配置，默认是3秒）
				}, function() {
					//location.href='index.html';
				});
			}
		});

	}

	function find(){
		get_data();
	}
	function set_click(){
		$(".ck_li").click(function(){
			$(".liactive").removeClass("liactive");
			$(this).addClass("liactive");
			var id=$(this).data("id");
			var log=arr[id];
			$("input[name=id]").val(log.id);
			$("input[name=real_name]").val(log.real_name);
			$("input[name=mobile]").val(log.mobile);
			$("input[name=wx_account]").val(log.wx_account);
			$("input[name=birthday]").val(log.birthday);
			$("input[name=pid1]").val(log.pid1);
			$("input[name=wx_account]").val(log.wx_account);
			$("#type").val('合伙人');
			$("#city").val(log['city']);
		})
	}
	
	get_data();
	function get_data(){
			$.ajax({
			type:"post",
			data:{
				name:$("#name").val(),
				page:1
			},
			url:"{:url('index/city/setpt')}",
			success:function(data){	
				var list=data.list;
				var html="";
				if(list&&list.length>0){
					for(var i=0;i<list.length;i++){
						var log=list[i];
						arr[log['id']]=log;
						html+='<li class="ck_li clearfix" data-id='+log.id+'>'+
				    		'<div class="pj">'+log.real_name+'<br/>ID'+log.id+'</div>'+
				    		'<div class="pj">'+log.mobile+'</div>'+
				    		'<div class="pj">'+log.tjname+'</div>'+
				    		'<div class="pj1">'+log.add_time+'</div>'+
				    		'<div class="pj">合伙人</div>'+
			    			'</li>';
					}
				}else{
					$("#no_record").show();
				}
				$(".list").html(html);
				set_click();
			}
		});
	}
	
	$(window).scroll(function(){
		var scrollTop = $(window).scrollTop();       //滚动条高度
		var bodyheight = $(document).height();         //文档的高度
		var windowheight = window.innerHeight;	//$(window).height();              //当前窗体的高度
		if((bodyheight - windowheight - scrollTop) == 0){
			$.ajax({
			type:"post",
			data:{
				name:$("#name").val(),
				page:parseFloat($("#page").val())+1
			},
			url:"{:url('index/city/skfk')}",
			success:function(data){	
				var list=data.list;
				var html="";
				if(list&&list.length>0){
					$("#page").val(parseFloat($("#page").val())+1);
					for(var i=0;i<list.length;i++){
						var log=list[i];
						arr[log['id']]=log;
						html+='<li class="ck_li clearfix" data-id='+log.id+'>'+
				    		'<div class="pj">'+log.real_name+'<br/>ID'+log.id+'</div>'+
				    		'<div class="pj">'+log.mobile+'</div>'+
				    		'<div class="pj">'+log.tjname+'</div>'+
				    		'<div class="pj1">'+log.add_time+'</div>'+
				    		'<div class="pj">合伙人</div>'+
			    			'</li>';
					}
				}else{
					$("#no_record").show();
				}
				$(".list").append(html);
				
			}
		});
		
		}				
	})

</script>
